<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta content="initial-scale=1.0,user-scalable=no,maximum-scale=1,width=device-width" name="viewport" />
<meta content="yes" name="apple-mobile-web-app-capable" />
<meta content="black" name="apple-mobile-web-app-status-bar-style" />
<meta content="telephone=no" name="format-detection" />
<title>无标题文档</title>
<script src="../js/jquery.js"></script>
    <script src="../jquery-2.2.3.min.js"></script>
    <script src="../method.js"></script>
    <script src="../js/bootstrap.min.js"></script>
    <#include "public/app/mxcss.ftl" >
</head>

<body>
<article class="hometop"><a href="javascript:history.back(-1);" class="left"><img src="../images/arrow-left.png"></a> <span>输入个人信息</span> </article>
<article class="usercenter">
    <section class="userlist mt22">
        <ul>
            <li>
                <ul>
                    <li class="fl"> <span>手&nbsp;机&nbsp;号&nbsp;码：</span> </li>
                    <li class="fl"> <span><input type="text" id="checkPhone" placeholder="输入绑定手机的号码"></span></li>
				</ul>
            </li>
            <li>
                <ul>
                    <li class="fl"> <span>手机验证码：</span> </li>
                    <li class="fl"> <span><input type="text" style="width:60px;"></span></li>
                    <li class="fr"> <span><a href="#"><img src="../images/input.png" style="width:80px;"></a></span> </li>
				</ul>
            </li>
            <li>
                <ul>
                    <li class="fl"> <span>输入验证码：</span> </li>
                    <li class="fl"> <span><input type="text" id="validateCode" style="width:60px;"></span></li>
<#--                    <li class="fr"> <span><img src="/images/yanzhen.png" style="width:80px;"></span></li>-->
                    <li class="fr"><img alt="验证码看不清，换一张" src="/drawimage" id="validateCodeImg" onclick="changeImg()">
                    <a href="javascript:void(0)" onclick="changeImg()">看不清，换一张</a></li>
                    <br/>
				</ul>
            </li>
        </ul>
    </section>
    <p>手机验证码将发送至您手机。</p>
<#--    <aside class="ml22 mr22 mb22 mt22"> <a href="/register/setregpassword" class="btn btn-orange">下一步</a> </aside>-->
    <aside class="ml22 mr22 mb22 mt22"> <a href="javascript:checkPhone()" class="btn btn-orange">下一步</a> </aside>
</article>

<script>
    function checkPhone(){
        var checkPhone = $("#checkPhone").val();
        var hidCode = $("#hidCode").val();
        var validateCode = $("#validateCode").val();
        var data = {phone : checkPhone,validateCode : validateCode};
        if(checkPhone == ""){
            alert("手机号不能为空");
            return ;
        }
        if(validateCode == ""){
            alert("验证码不能为空");
            return ;
        }

        var url = "/register/checkphone";
        postReq(url,data,function(result){
            if(result.success){
                location.href="/register/setregpassword";
            }else{
                alert(result.msg);
                if(result.msg == "该手机号已注册,可直接登录"){
                    location.href="/appindex";
                }
            }
        });
    }

    function changeImg(){
        var p = $("#validateCodeImg");
        // p.src ="/drawimage?"+Math.random();
        // p.attr("src","") ;
        p.attr("src","/drawimage?"+Math.random()) ;//设置图像p的src属性  jQuery方法

        // document.getElementById("validateCodeImg").src="/drawimage?"+Math.random();
        // $("validateCodeImg").src="/drawimage";
        // $("validateCodeImg").prop('src','/drawimage?a='+new Date().getTime());
        // location.href="/drawimage";
    }
</script>
</body>
</html>